02_COMPUTER_SCIENCE_NOTES PORTAL
Week 3 Algorithms · Dual Sovereign Core (AR / EN)
⚑ DATA STRUCTS & ASYMPTOTIC THEORY
AYMAN ELMASRY
Computational Creative Director · AI Prompt Engineer
Founder of Ayman Elmasry LLC
πŸ”’ ⚑ AEL Sovereign Seal (Active Master Verification)
{
  "ael_seal": "AEL CS Encyclopedia β€” Β© Ayman Elmasry",
  "owner": "Ayman Elmasry",
  "legal_entities": [
    "Ayman Elmasry LLC (UAE)",
    "Ayman Elmasry Advertising & Marketing (Egypt)"
  ],
  "syllabus_source": "Harvard CS50x 2026-2027",
  "domain": "Week 3: Data Structs & Computational Theory",
  "document_type": "02_Computer_Science_Notes",
  "methodology": "8-Stage Sub-Silicon Execution Paradigm",
  "system_version": "v3.0"
}

Week 3 Computer Science Notes: Structs & Sorting Benchmarks

Section 1: Memory Encapsulation & Struct Architecture

During initial iterations of phone book construction, developers are forced to instantiate decoupled parallel buffers. However, there exists zero physical memory correlation between the two. Bare-metal C provides an explicit mechanism to declare custom composite data types that encapsulate multiple variables inside a unified memory block via typedef struct.

===================================================================================
             CUSTOM STRUCT MEMORY ENCAPSULATION
===================================================================================

  [ person: people[0] ]
  β”œβ”€β”€ name   ──> Pointer to "David"
  └── number ──> Pointer to "+1-949-468-2750"

===================================================================================
  • Custom Structural Instantiation: Maintains the relational integrity of the database during complex index swapping routines.

Section 2: Mathematical Sorting Benchmarks

The Comprehensive Asymptotic Benchmark Matrix contrasts the distinct asymptotic limits across sorting and searching heuristics.

===================================================================================
             ASYMPTOTIC BENCHMARK MATRIX
===================================================================================
Algorithm         Worst Case (Big O)   Best Case (Big Omega)   Paradigm
-----------------------------------------------------------------------------------
Bubble Sort       O(n^2)               Omega(n)                Pairwise Swapping
Selection Sort    O(n^2)               Omega(n^2)              Min Insertion
Merge Sort        O(n log n)           Omega(n log n)          Divide & Conquer
Linear Search     O(n)                 Omega(1)                Sequential Search
Binary Search     O(log n)             Omega(1)                Halving Partitions
===================================================================================
  • Architectural Understanding of Omega(1): Represents the optimal asymptotic boundary: discovering the target payload on the absolute initial inspection.

Section 3: Recursive Stack Mechanics & Activation Records

When a routine self-invokes, the operating system kernel allocates a distinct activation record within the execution call stack.

  • The Base Case Hazard: Omitting a definitive base case condition accumulates frames indefinitely, triggering a fatal Stack Overflow.